{%if patchset.url%}
  <div>
    Downloaded from: <a href="{{patchset.url}}">{{patchset.url}}</a>
  </div>
{%endif%}
<div class="issue-list">

  <div class="pagination">
    <div style="float: left;">
      <i>Created:</i> {{patchset.created|timesince}} ago
    </div>
    <div style="float: right;">
      {%if patchset.data%}
        Download
          <a href="{%url codereview.views.download issue.key.id,patchset.key.id%}"
            title="Patchset in text format">[raw]</a>
          <a href="{%url codereview.views.tarball issue.key.id,patchset.key.id%}"
            title="Tarball containing the original and patched files">[tar.bz2]</a>
      {% else %}
        <span class="disabled">(Patch set is too large to download)</span>
      {% endif %}
    </div>
    <div style="clear:both;"></div>
  </div>

  <table id="queues" style="clear:both;">
    <tr align="left">
      <th colspan="2"></th>
      <th>Unified diffs</th>
      <th>Side-by-side diffs</th>
      <th>Delta from patch set</th>
      <th colspan="3">Stats <font style='font-weight: normal'>(<i>+{{patchset.total_added}} line{{patchset.total_added|pluralize}}, -{{patchset.total_removed}} line{{patchset.total_removed|pluralize}}</i>)</font></th>
      <th>Patch</th>
    </tr>

    {%for patch in patchset.patches_cache%}
      <tr name="patch">
        <td class="first" width="14"><img src="{{media_url}}closedtriangle.gif"
    style="visibility: hidden;" width="12" height="9" /></td>
        <td style="white-space: nowrap">{%if patch.status%}{{patch.status}}{%endif%}</td>
        <td>
          <a class="noul"
             href="{%url codereview.views.patch issue.key.id,patchset.key.id,patch.key.id%}">
            {{patch.filename}}
          </a>
        </td>
        <td>
          <a class="noul"
             href="{%url codereview.views.diff issue.key.id,patchset.key.id,patch.filename%}">
            View
          </a>
        </td>
        <td style="white-space: nowrap">
        {%for delta in patch.parsed_deltas%}
          <a href="{%url codereview.views.diff2 issue.key.id,delta.1,patchset.key.id,patch.filename%}"
             title="Delta from patch set {{delta.0}}">{{delta.0}}</a>
        {%endfor%}
        </td>
        {%if patch.is_binary%}
          <td style="white-space: nowrap" colspan="2"><i>Binary file</i></td>
        {%else%}
          <td style="white-space: nowrap">{{patch.num_chunks}} chunk{{patch.num_chunks|pluralize}}</td>
          <td style="white-space: nowrap">+{{patch.num_added}} line{{patch.num_added|pluralize}}, -{{patch.num_removed}} line{{patch.num_removed|pluralize}}</td>
        {%endif%}
        <td style="white-space: nowrap">
          {%if patch.num_comments or patch.num_drafts%}<b>{%endif%}
            {{patch.num_comments}} comment{{patch.num_comments|pluralize}}
            {%if patch.num_my_comments%}
              ({{patch.num_my_comments}} by me)
            {%endif%}
            {%if patch.num_drafts%}
            <span style="color:red">+
              {{patch.num_drafts}} draft{{patch.num_drafts|pluralize}}
            </span>
            {%endif%}
          {%if patch.num_comments or patch.num_drafts%}</b>{%endif%}
        </td>
        <td>
          <a href="{%url codereview.views.download_patch issue.key.id,patchset.key.id,patch.key.id%}"
             title="Download patch for {{patch.filename}}">
            Download
          </a>
        </td>
      </tr>
    {%endfor%}
  </table>

  {%if patchset.depends_on_patchset %}
    <p>
      <i>Depends on Patchset:</i>
        <div {%if patchset.depends_on_tokens.0.closed%}class="linethrough"{%endif%}>
          <a href="/{{patchset.depends_on_tokens.0.key.id}}#ps{{patchset.depends_on_tokens.1.key.id}}">
            Issue {{patchset.depends_on_tokens.0.key.id}} Patch {{patchset.depends_on_tokens.1.key.id}}
          </a>
      </div>
    </p>
  {%endif%}
  {%if patchset.dependent_patchsets %}
    <p>
      <i>Dependent Patchsets:</i>
      {%for dependent_tokens in patchset.dependent_tokens%}
        <div {%if dependent_tokens.0.closed%}class="linethrough"{%endif%}>
          <a href="/{{dependent_tokens.0.key.id}}#ps{{dependent_tokens.1.key.id}}">
            Issue {{dependent_tokens.0.key.id}} Patch {{dependent_tokens.1.key.id}}
          </a>
        </div>
      {%endfor%}
    </p>
  {%endif%}
</div>
